/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!				\file		CC_App.h
	\date		june 2010
	\author		TNick

	\brief		Contains the definition of CC_App class and related


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read ReadMe.txt and Licence.txt in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef		__CC_APP_INC__
#define		__CC_APP_INC__
#ifdef		__cplusplus
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

class		MainWindow;

#include	<QString>
#include	<QDataStream>
#include	<assert.h>

#include	"CC_Err.h"
#include	"CC_Draw.h"
#include	"CC_PlugIn.h"
#include	<generic/cc_l2dn.h>
#include	<gui/var/MainWindow.h>


/// holds application return value
extern		unsigned			uAppErrCode;

/// this is main application window
extern		MainWindow*			g_MW;

/*  INCLUDES    ============================================================ */
//
//
//
//
class	TR : public QObject	{
	Q_OBJECT
};

/// application's class; only one class per running instance
/**
*	This class is only created once, when the application is starting. It is
*	the root of the program; all other elements are tied to this class. @N
*	CC_App should not be inherited.
*/
class	CC_App	{


	//
	//
	//
	//
	/*  DEFINITIONS    --------------------------------------------------------- */


	/*  DEFINITIONS    ========================================================= */
	//
	//
	//
	//
	/*  DATA    ---------------------------------------------------------------- */

private:

	/// tell that application is running
	static unsigned			uApp;

	/// Application object from QT perspective
	static QApplication*		QT_App;

	/// header for list of drawings
	static CC_HDL2DN			Drawings;

	/// header for list of plugins
	static CC_HDL2DN			PlugIns;

	/// header for list of toolbars
	static CC_HDL2D				Toolbars;

	/// header for list of toolbars
	static CC_HDL2D				Menus;

	/// header for list of actions
	static CC_HDL2D				Actions;


	/*  DATA    ================================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ----------------------------------------------------------- */

	/// launcher; called only once when application is starting
public:	static bool	TakeOff(QApplication* qtApp);
	/// lander; called only once when application is ending
public:	static void	Landing(void);


public:
	/// return a pointer to drawing header
	static inline CC_HDL2DN* GetDrawHeader()
	{Q_ASSERT(uApp != 0); return &Drawings;}
	/// return a pointer to plug-ins header
	static inline CC_HDL2DN* pluginHeader()
	{ return &PlugIns;}
	/// return a pointer to toolbars header
	static inline CC_HDL2D* toolbarsHeader()
	{ return &Toolbars;}
	/// return a pointer to menus header
	static inline CC_HDL2D* menusHeader()
	{ return &Menus;}
	/// return a pointer to actions header
	static inline CC_HDL2D* actionsHeader()
	{ return &Actions;}
	/// return a pointer to application object
	static inline QApplication* appHeader()
	{ return QT_App;}

	/*  FUNCTIONS    =========================================================== */
	//
	//
	//
	//

};	/*	class	CC_App	*/
//
//
//
//
#endif	//	__cplusplus
#endif	//	__CC_APP_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
